import java.util.Arrays;

public class demo1 {
    public static void main(String[] args) {
          int[]arr={1,2,3,4,5,6};
          func(arr);
        System.out.println(Arrays.toString(arr));
    }
    public static void func(int[]arr){
        int i =0;
        int j = arr.length-1;
        while(i<j){
            while (i<j&&arr[i]%2!=0){
                i++;
            }
            while(i<j&&arr[j]%2==0){
                j--;
            }
            int tmp=arr[i];
            arr[i]=arr[j];
            arr[j]=tmp;
        }
    }
}
